The Call JavaScript action lets you use the Behavior inspector to specify that a custom function or line of JavaScript code should be executed when an event occurs.
To use the Call JavaScript action:
1 | Select an object and open the Behavior inspector. |
2 | Click the plus (+) button and choose Call JavaScript from the Actions pop-up menu. |
3 | Type the exact JavaScript to be executed, or type the name of a function. |
For example, to create a Back button, you might type if (history.length > 0){history.back()} . If you have encapsulated your code in a function, type only the function name (for example, goBack() ). |
|
4 | Click OK. |
5 | Check that the default event is the one you want. |
If it isn't, choose another event from the pop-up menu. If the events you want are not listed, change the target browser in the Events For pop-up menu. | |
![]() |